package com.lb.date;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalField;

/**
 * @Author: zhangjun
 * @Date: 2020/5/22 15:14
 * @Description: 日期
 */
public class DateTest {
    public static void main(String[] args) {
        /*LocalDateTime localDateTime = LocalDateTime.now();

        System.out.println("========输出默认格式=========");
        System.out.printf("当前时间：%s%n",localDateTime.toString());

        System.out.println("========输出指定格式=========");
        System.out.printf("当前时间：%s%n",localDateTime.format(DateTimeFormatter.ofPattern("yyyy-HH-dd HH:mm:ss")));

        System.out.println("========定义指定时间=========");
        localDateTime = LocalDateTime.of(2019,10,30,10,0,0);
        System.out.printf("当前时间：%s%n",localDateTime.format(DateTimeFormatter.ofPattern("yyyy-HH-dd HH:mm:ss")));


        LocalDateTime now = LocalDateTime.now().minusDays(1);
        System.out.println(now);*/

        int a = 0;
        int b = 1;
        int c = 2;

        System.out.println(a ^ 1);
        System.out.println(b ^ 1);
        System.out.println(c ^ 1);

        LocalDateTime now = LocalDateTime.now();
        LocalDateTime futureTime =  now.plusYears(5).minusHours(now.getHour()).minusMinutes(now.getMinute()).minusSeconds(now.getSecond()+1);
        System.out.println("now : " + now.getHour());
        System.out.println("now : " + now.getMinute());
        System.out.println("now : " + now.getSecond());
        System.out.println("now : " + now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        System.out.println("futureTime : " + futureTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        System.out.println(Timestamp.valueOf(now).getTime());
    }

}
